Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop request and response from Application and bootstrap event #162

Open
wants to merge 13 commits into
base: 4.0.x
Choose a base branch
from

Conversation

Xerkus
Copy link
Member

@Xerkus Xerkus commented Jan 6, 2024

Q A
Documentation no
Bugfix no
BC Break yes
New Feature yes
RFC no
QA no

Description

Current application setup relies on shared request and response objects in Application, in MvcEvent and in Container.
Ultimately MvcEvent would become the only source of truth (besides instances passed around as arguments).

This PR changes Application to drop request and response properties and deprecates accessor methods for them. Deprecated accessor methods now proxy to MvcEvent instance.

Request and response instances are dropped from bootstrap event.

New Application event prepare is introduced to allow request dependent preparation logic that some users have in bootstrap to be invoked at a proper place. prepare event is part of Application::run() as it is the only reasonable place where http request can be available.
Application switched to closure based request/response factories. Those are placeholders as factory classes would need to be introduced in laminas-http.

Request and response would be dropped from container in a separate PR.

This PR depends on and includes commits from #161

Psalm issues which are not directly related intentionally left unfixed to be handled in a separate PR.
Documentation for the changes is to be done via separate PR. See #58

ApplicationInterface was never properly utilized and some parts of the
MVC application are implicitly depending on Laminas\Mvc\Application.
It is not type safe and with the general direction towards dependency injection
with container-exists-first approach there is hardly any value in keeping the interface.

Signed-off-by: Aleksei Khudiakov <[email protected]>
Use double-dispatch approach to ensure default listeners are registered.

Signed-off-by: Aleksei Khudiakov <[email protected]>
Signed-off-by: Aleksei Khudiakov <[email protected]>
Signed-off-by: Aleksei Khudiakov <[email protected]>
Deprecate `Application::getServiceManager()` to be removed in next
major.

Remove usage of `Application::getServiceManager()` in ViewManager listener.

Signed-off-by: Aleksei Khudiakov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant